#include "widget.h"
#include "ui_widget.h"
#include<QPushButton>
#include<QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QPushButton* button = new QPushButton(this);
    button->setText("按钮");
    button->move(200, 200);

//    connect(button, &QPushButton::clicked, this, [button, this](){
//        qDebug() << "lamdba实现槽函数并且被连接";
//        button->move(300, 300);
//        this->move(100, 100);
//    });

    connect(button, &QPushButton::clicked, this, [=](){
        qDebug() << "lamdba实现槽函数并且被连接";
        button->move(300, 300);
        this->move(100, 100);
    });
}

Widget::~Widget()
{
    delete ui;
}


